<template>
  <div class="app-container">
    <el-row>
      <el-col :span="23" :offset="1" style="margin-bottom: 10px;margin-top: 10px;">
        <el-breadcrumb separator="/">
          <el-breadcrumb-item :to="{ path: '/loginLog' }" class="bread"><i class="el-icon-location-outline"></i>日志管理</el-breadcrumb-item>
          <el-breadcrumb-item :to="{ path: '/operLog' }" class="bread">操作日志管理</el-breadcrumb-item>
        </el-breadcrumb>
      </el-col>
    </el-row>
<!--    <el-row>-->
<!--      <el-col :span="7" :offset="17">-->
<!--        <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" v-show="showSearch">-->
<!--          <el-form-item prop="menuName">-->
<!--            <el-input-->
<!--                class="inputem"-->
<!--                v-model="queryParams.userName"-->
<!--                placeholder="请输入用户名"-->
<!--                clearable-->
<!--                @keyup.enter.native="handleQuery"/>-->
<!--          </el-form-item>-->
<!--          <el-form-item>-->
<!--            <el-button icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>-->
<!--            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>-->
<!--          </el-form-item>-->
<!--        </el-form>-->
<!--      </el-col>-->
<!--    </el-row>-->

    <el-row type="flex" justify="center">
      <el-col :span="22">
        <div class="mytable">
          <el-table height="510" stripe :data="loginLogList" class="tabletab" header-cell-class-name="table_header">
            <el-table-column
                type="selection"
                width="55">
            </el-table-column>
<!--            <el-table-column label="操作用户" prop="operName"></el-table-column>-->
<!--            <el-table-column label="操作ip" prop="operIp"></el-table-column>-->
            <el-table-column label="请求地址" prop="operUrl"></el-table-column>
            <el-table-column label="请求方式" prop="requestMethod"></el-table-column>
            <el-table-column label="请求主机" prop="businessType"></el-table-column>
<!--            <el-table-column label="登入终端" prop="os"></el-table-column>-->
            <el-table-column label="请求结果" prop="status">
              <template slot-scope="scope">

<!--                {{// scope.row.status==0?"操作成功":"操作失败" }}-->
                {{'操作成功'}}
              </template>
            </el-table-column>
            <el-table-column label="请求时间" prop="operTime">
              <template slot-scope="scope">
                {{ parseTime(scope.row.operTime) }}
              </template>
            </el-table-column>
            <el-table-column label="操作时间" prop="costTime">
              <template slot-scope="scope">
                {{scope.row.costTime}} ms
              </template>
            </el-table-column>
            <el-table-column label="操作" align="center" v-if="false"  class-name="small-padding fixed-width" >
              <template slot-scope="scope" v-if="scope.row.roleId !== 1">
                <el-button
                    size="mini"
                    type="text"
                    v-hasPermi="['sys:oper:detail:show']"
                    @click="showDetail(scope.row)"
                ><i class="el-icon-edit" style="color: #4C87C2;"></i>详情查看</el-button>
              </template>
            </el-table-column>

          </el-table>
        </div>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="8" :offset="15">
        <div class="block" >
          <pagination
              class="pager"
              v-show="total>0"
              :total="total"
              :page.sync="queryParams.pageNum"
              :limit.sync="queryParams.pageSize"
              @pagination="getList"
          />
        </div>
      </el-col>
    </el-row>

  </div>
</template>

<script>
import {eporlogList} from "@/api/log/log";

export default {
  name: "loginLog",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 显示搜索条件
      showSearch: true,
      // 登入日志数据
      loginLogList: [],

      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 是否展开，默认全部折叠
      isExpandAll: false,
      // 重新渲染表格状态
      refreshTable: true,
      // 查询参数
      queryParams: {
        pageSize:10,
        pageNum:1,
        userName: undefined,
      },
      total:0,
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        menuName: [
          {required: true, message: "菜单名称不能为空", trigger: "blur"}
        ],
        orderNum: [
          {required: true, message: "菜单顺序不能为空", trigger: "blur"}
        ],
        path: [
          {required: true, message: "路由地址不能为空", trigger: "blur"}
        ]
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    // 选择图标
    selected(name) {
      this.form.icon = name;
    },
    /** 查询菜单列表 */
    getList() {
      this.loading = true;
      eporlogList(this.queryParams).then(res=>{
        this.loginLogList = res.rows
        this.loading = false;
        this.total = res.total
      })
    },
    // 表单重置
    /** 搜索按钮操作 */
    handleQuery() {
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams = {
        pageSize:10,
        pageNum:1
      }
      this.handleQuery();
    },
    showDetail(row){

    }
  }
};
</script>

<style scoped>
.bread /deep/ .el-breadcrumb__inner{
  color: #000000;
}
.bread /deep/ .el-breadcrumb__inner:hover{color: #000000;}
.el-button{
  background-color: #4686D0;
  color: #ffffff;
  border: #4686D0;
  font-size: 12px;
  font-family: "微软雅黑";
}
.el-row{
  margin-top: 20px;
  margin-bottom:20px;
}
.el-input{
  width:250px;
}
.inputem /deep/ .el-input__inner {
  background-color: rgba(0, 0, 0, 0) ;
  border:1px solid #B1B4C5;
}
.inputem /deep/ .el-input__inner:focus{
  border:2px solid #4c87c2;
}
.inputem /deep/ .el-input__inner:hover{
  border:2px solid #4c87c2;
}

.inputem /deep/ .el-input-group__append{
  background-color: #265389;
  border:1px solid #265389;
}
.el-icon-search{
  color: #ffffff;
}
</style>
